
<%@page import="uk.ac.sanger.dasregistry.timer.Mirroring"%><jsp:directive.page session="true" />

<jsp:useBean id="register" class="dasregistry.registryBean" scope="session"/> 
<jsp:useBean id="server" class="dasregistry.serverBean" scope="session"/>

<jsp:setProperty name="server" property="*" />

<jsp:directive.page import="org.biojava.dasobert.dasregistry.Das1Validator"/>
<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasCoordinateSystem"/>
<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasCoordinateSystem"/>
<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasCoordSysComparator"/>
<jsp:directive.page import="org.biojava.services.das.registry.DasRegistrySql" />
<jsp:directive.page import="java.util.Comparator"/>

<%@ page import="org.biojava.services.das.dao.Role" %>
<%@ page import="org.biojava.services.das.dao.RegistryUser" %>
<%@ page import="org.biojava.services.das.registry.UserManager" %>
<%@ page import="java.util.List" %>
<jsp:directive.page import="org.springframework.beans.factory.BeanFactory"/>
<jsp:directive.page import="org.springframework.context.support.ClassPathXmlApplicationContext"/>
<%@ include file="logincheck.jsp" %>

<%
response.setHeader("Cache-Control","private"); //HTTP 1.1
response.setHeader("Pragma","private"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server   
 

%>

<%@ include file="sangerheader.jsp" %>

<div id="main">
<h1>Test DAS Server sources response:</h1>
<%
if ( email == null ) {
	
	%>
	<%@ include file="needToLogIn.jsp" %>
	<% 
	}else{
		

%>


Server sources path=<%=server.getSourcesPath()%>
<% 
BeanFactory ctx=(new ClassPathXmlApplicationContext("SpringDAO.xml"));
UserManager manager=(UserManager)ctx.getBean("userManager");


RegistryUser usr=manager.getUser(email);

			//if result is "" then it is ok and continue
			//if anything else then we have a problem
			
			//we don't want to register it if someone owns it already i.e. user is !=0 unless it is the owner in which case we want to update it
			
			//if no user allocated then fine validate the sources document and if valid add the server with the owner
			String result=server.storeInDb(email);
			if(result==""){
			out.print("Your server has been succesfully registered");
			}else{
				out.print("<font color=\"red\">"+result+"<font\\/>");
			}
	}
			%>



</div>
<%@ include file="sangerfooter.jsp" %>